package util;

import java.io.Serializable;

import org.hibernate.LockMode;
import org.hibernate.Session;


/**
 * Data access object (DAO) for domain model
 * @author MyEclipse Persistence Tools
 */
public class BaseHibernateDAO implements IBaseHibernateDAO {
	
	public Session getSession() {
		return HibernateSessionFactory.getSession();
	}

	public Object findById(Class entityClass, Serializable id, boolean lock) {
		Object object;
		if (lock)
			object = getSession().get(entityClass, id, LockMode.UPGRADE);
		else
			object = getSession().get(entityClass, id);
		return object;
	}
	
}